﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using VietPublisher.Web.Framework;
using VietPublisher.BSL.BK;
using VietPublisher.BaseProject.Models;

namespace VietPublisher.Web.BK.Controllers.Admin
{
    public class CategoryController : StringBaseEntityController
    {
        //
        // GET: /Category/
        [CustomAuthorize(Roles = SiteRoles.Admin)] 
        public ActionResult Index()
        {
            return View();
        }

        [CustomAuthorize(Roles = SiteRoles.Admin)]
        public ActionResult CategoryList()
        {
            List<T_BK_Category> categories = RepoCategory.GetCategorys();
            return View("List_Category",categories);
        }

        //
        // Get : /Category
        [HttpGet, CustomAuthorize(Roles = SiteRoles.Admin)]
        public ActionResult CreateCategory()
        {
            return View();
        }


        //
        // Post : /Category
        [HttpPost, CustomAuthorize(Roles = SiteRoles.Admin)]
        public ActionResult DoCreateCategory(FormCollection collection)
        {
            return View();
        }


        //
        // Get : /Category
        [HttpGet, CustomAuthorize(Roles = SiteRoles.Admin)]
        public ActionResult UpdateCategory()
        {
            return View();
        }


        //
        // Post : /Category
        [HttpPost, CustomAuthorize(Roles = SiteRoles.Admin)]
        public ActionResult DoUpdateCategory(FormCollection collection)
        {
            return View();
        }


        //
        // Get : /Category
        [HttpGet, CustomAuthorize(Roles = SiteRoles.Admin)]
        public ActionResult DeleteCategory(int CategoryID)
        {
            return View();
        }

        /// <summary>
        /// call popup when modify book, this popup can be add Category to group
        /// or creat new Category 
        /// </summary>
        /// <returns></returns>
        [CustomAuthorize(Roles = SiteRoles.Admin)]
        public ActionResult OpenCategoryPopup()
        {
            var allCategory = RepoCategory.GetCategorys().Where(m=>m.IsAdmin== false).ToList();
            ViewData["Category"] = allCategory;
            return View();
        }

    }
}
